package com.gdkj.enums;

/**
 * 星球探索-前端道具类型映射
 *
 * @author: zw
 * @date: 2022/10/31
 **/
public enum DiggingTypePropEnums {

    soil(5, 3),         //
    shield(6, 4),       //
    darkroom(7, 5),    //
    key(8, 6),          //
    energy(9, 2),      //
    energytwo(10, 2),  //
    beans(1000, 1);     //金豆

    ;

    private Integer code;

    private Integer name;

    DiggingTypePropEnums(Integer code, Integer name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getName() {
        return name;
    }

    public void setName(Integer name) {
        this.name = name;
    }

    /**
     * 根据code获取name值
     *
     * @param code : code
     * @return : java.lang.String
     * @author chenyanqian
     * @date 2022/11/2
     */
    public static Integer getPropNameByCode(Integer code) {
        DiggingTypePropEnums[] enums = DiggingTypePropEnums.values();
        for (DiggingTypePropEnums diggingPropEnum : enums) {
            if (diggingPropEnum.code.equals(code)) {
                return diggingPropEnum.name;
            }
        }
        return null;
    }


    public static Integer getCodeByPropName(Integer name) {
        DiggingTypePropEnums[] enums = DiggingTypePropEnums.values();
        for (DiggingTypePropEnums diggingPropEnum : enums) {
            if (diggingPropEnum.name.equals(name)) {
                return diggingPropEnum.code;
            }
        }
        return null;
    }
}
